<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<script type="text/javascript">
  	$(function(){
  		$("#deleteFriend").click(function(){
		   	var data=$("#friendForm :checkbox[name=friend1]:checked").serialize();
		    location.href="deleteFriend.do?"+data;
		   //alert(data + "bbbbbbbbbbbbbbbbbbbbbbbbbbbb");
  		});
  		
  		$("#giftPoint").click(function(){
		   	var data=$("#friendForm :checkbox[name=friend1]:checked").next().serialize();
		   location.href="giftPoint.do?point="+$("#point").val()+"&"+data;
		  // alert(data);
  		});
  		
  		$(":input[name=mess]").click(function(){
			var send = $(this).next().val();
			//alert(send);
			location.href="sendMemosView.do?id="+send;
  		});
  		
  		
  		
  		
  		  		
  	});
  </script>


<h1>친구목록</h1><br>


입력 <input type="text" id="point" size="5"> point
<input type="button" id="giftPoint" value="선물하기">
<input type="button" id="deleteFriend" value="친구삭제">

<form id="friendForm">
<table border="1">
<tr>
<th></th><th>ID</th><th>Name</th><th>Grade</th><th>쪽지</th>
</tr>
<c:forEach items="${requestScope.flist}" var="f">
<tr>
	<td><input type="checkbox" name="friend1"  value="${f.no}">
	<input type="hidden" name="id" value="${f.friends.id }">
	</td>
	<td>${f.friends.id }</td>
	<td>${f.friends.name }</td>
	<td>${f.friends.grade }</td>
	<td><input type="button" name="mess" value="보내기">
	<input type="hidden" name="send" value="${f.friends.id }">
	</td>
</tr>
</c:forEach>
<tr>
	<td colspan="5" align="center"><a href="newFriends.do?id=${sessionScope.mvo.id }">친구추가 +</a></td>
</tr>
</table>
</form>